<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>图书管理系统首页</title>
    <meta charset="utf-8">
    <link rel="stylesheet" type="text/css" href="/css/admin.css">
</head>
<body>
<div class="header">
    <div class="logo">
        <img src="/images/Logo.png">
    </div>
    <div class="title">
        欢迎使用图书管理系统
    </div>
    <div class="nav">
        <ul>
            <li><a href="/">返回系统首页</a></li>
        </ul>
    </div>
</div>
<div class="content1">
    <form name="query" action="/adminGetbook" method="GET">
        <div class="soso">
            <div class="ti">用户图书检索:</div>
            <div class="select">
                <select name="query">
                    <option value="name">按书名查询</option>
                    <option value="bookid">按书号查询</option>
                    <option value="author">按作者查询</option>
                    <option value="publisher">按出版社查询</option>
                    <option value="type">按类别查询</option>
                    <option value="username">按学生姓名查询</option>
                    <option value="userid">按学生学号查询</option>
                    <option value="all">全部图书</option>
                </select>
            </div>
            <div class="text"><input type="text" name="data"></div>
            <div class="button"><input type="submit" value="点击检索"></div>
        </div>
    </form>
</div>
<div class="result">
    @if($isQuery == 1)
        @if(count($books) == 0)
            <p>没有您所要检索的书籍！</p>
        @else
            <p>找到{{count($books)}}条检索结果</p>
            @if($isBookQuery == 1)
                <table border="1" cellspacing="0">
                    <tr>
                        <th>书号</th>
                        <th>书名</th>
                        <th>作者</th>
                        <th>出版社</th>
                        <th>类别</th>
                        <th>收录时间</th>
                        <th>修改书籍</th>
                        <th>删除书籍</th>
                    </tr>
                    @foreach($books as $book)
                        <input type="hidden" name="_method" value="PUT"/>
                        <tr>
                            <td>{{$book->bookid}}</td>
                            <td>{{$book->name}}</td>
                            <td>{{$book->author}}</td>
                            <td>{{$book->publisher}}</td>
                            <td>{{$book->type}}</td>
                            <td>{{$book->created_at}}</td>
                            <td><a href="/updateIndex/{{$book->id}}">点击修改</a></td>>
                            <form action="/book/{{$book->id}}" method="POST">
                                <input type="hidden" name="_method" value="DELETE"/>
                                <td><input type="submit" value="点击删除"></td>
                            </form>
                        </tr>
                    @endforeach
                </table>
            @else
                <table border="1" cellspacing="0">
                    <tr>
                        <th>姓名</th>
                        <th>学号</th>
                        <th>书号</th>
                        <th>书名</th>
                        <th>作者</th>
                        <th>出版社</th>
                        <th>类别</th>
                        <th>收录时间</th>
                        <th>到期时间</th>
                        <th>续借</th>
                        <th>还书</th>
                    </tr>
                    @foreach($books as $book)
                        <input type="hidden" name="_method" value="PUT"/>
                        <tr>
                            <td>{{$book->userid}}</td>
                            <td>{{$book->username}}</td>
                            <td>{{$book->bookid}}</td>
                            <td>{{$book->name}}</td>
                            <td>{{$book->author}}</td>
                            <td>{{$book->publisher}}</td>
                            <td>{{$book->type}}</td>
                            <td>{{$book->created_at}}</td>
                            <td>{{$book->return_date}}</td>
                            <form action="/addTime/{{$book->id}}" method="POST">
                                <input type="hidden" name="_method" value="PUT"/>
                                <td><input type="submit" value="点击续借"></td>
                            </form>
                            <form action="/returnBook/{{$book->id}}" method="POST">
                                <input type="hidden" name="_method" value="DELETE"/>
                                <td><input type="submit" value="点击还书"></td>
                            </form>
                        </tr>
                    @endforeach
                </table>
            @endif
        @endif
    @endif
</div>
<div class="content2">
    <form action="/book" method="POST">
        @if(count($errors)>0)
            <ul class="errors">
                @foreach ($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        @endif
        <div class="input">
            <div class="ti">图书导入：</div>
            <div class="one">书号：</div>
            <div class="two"><input type="text" name="bookid" value="{{old('bookid')}}"></div>
        </div>
        <div class="input">
            <div class="three">书名：</div>
            <div class="two"><input type="text" name="name" value="{{old('name')}}"></div>
        </div>
        <div class="input">
            <div class="three">作者：</div>
            <div class="two"><input type="text" name="author" value="{{old('author')}}"></div>
        </div>
        <div class="input">
            <div class="three">出版社：</div>
            <div class="four"><input type="text" name="publisher" value="{{old('publisher')}}"></div>
        </div>
        <div class="input">
            <div class="three">类别：</div>
            <div class="two"><input type="text" name="type" value="{{old('type')}}"></div>
        </div>
        <div class="input">
            <div class="five">
                <input type="submit" value="导入图书">
            </div>
        </div>
    </form>
</div>
<div class="footer">
    &copy; 2017&nbsp;&nbsp;&nbsp;&nbsp;玉言为光小组版权所有&nbsp;&nbsp;&nbsp;&nbsp;未经授权&nbsp;&nbsp;&nbsp;&nbsp;不得转载&nbsp;&nbsp;&nbsp;&nbsp;杭电ICP备666666号
</div>
</body>
</html>